home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr27 / gs26.zip / LANGUAGE.DOC < prev    next >
Text File  |  1993-03-20  |  16KB  |  439 lines

  1.    Copyright (C) 1989-1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, language.doc, describes the Ghostscript language.
  23.  
  24. For an overview of Ghostscript and a list of the documentation files, see
  25. README.
  26.  
  27. The Ghostscript interpreter, except as noted below, is intended to execute
  28. properly any source program written in a language defined by reference to
  29. the December 1990 printing of the PostScript Language Reference Manual
  30. (Second Edition) published by Addison-Wesley (ISBN 0-201-18127-4).  The
  31. Ghostscript language includes the following elements of the PostScript
  32. (TM) language:
  33.  
  34.     - The full PostScript Level 1 language, as also defined in the
  35. first edition of the PostScript Language Reference Manual, ISBN
  36. 0-201-10174-2, Addison-Wesley, 1985.
  37.  
  38.     - The CMYK color, file system, version 25.0 language, and
  39. miscellaneous additions listed in sections A.1.4, A.1.6, A.1.7, and
  40. A.1.8 of the Second Edition respectively, including allowing a string
  41. operand for the 'status' operator;
  42.  
  43.     - The Display PostScript extensions listed in section A.1.3
  44. of the Second Edition, but excluding the operators listed in section
  45. A.1.2.  These facilities are only available if the dps feature or the
  46. level2 feature was selected at the time that Ghostscript was compiled
  47. and linked.
  48.  
  49.     - The composite font extensions listed in section A.1.5 of
  50. the Second Edition, but not the ability to handle Type 0 fonts.
  51. These facilities are only available if the compfont feature or the
  52. level2 feature was selected at the time that Ghostscript was compiled
  53. and linked.
  54.  
  55.     - A subset of the other PostScript Level 2 operators and
  56. facilities listed in section A.1.1 of the Second Edition, identified
  57. below.  These facilities are only available if the level2 feature was
  58. selected at the time that Ghostscript was compiled and linked.
  59.  
  60. Ghostscript also includes a number of operators defined below that are not
  61. in the PostScript language.
  62.  
  63. Stub facilities
  64. ---------------
  65.  
  66. The following operators, while provided in the current release, have only
  67. a partial or dummy implementation.
  68.  
  69. Form and pattern operators:
  70.     execform
  71.  
  72. Graphics state operators:
  73.     currentblackgeneration, currentcolorscreen,
  74.     currenthalftonephase, currentundercolorremoval,
  75.     setblackgeneration, setcolorscreen,
  76.     sethalftonephase, setundercolorremoval,
  77.     currenthalftone, sethalftone
  78.  
  79. Interpreter parameter operators:
  80.     currentsystemparams, currentuserparams
  81.     setsystemparams, setucacheparams, setuserparams
  82.     ucachestatus
  83.  
  84. Path construction operators:
  85.     ucache
  86.  
  87. Virtual memory operators:
  88.     currentshared, scheck, setshared, setvmthreshold, shareddict,
  89.     SharedFontDirectory, vmreclaim
  90.  
  91. Miscellaneous operators:
  92.     serialnumber
  93.  
  94. Unclassified Level 2 operators
  95. ------------------------------
  96.  
  97. Ghostscript provides the following PostScript Level 2 operators
  98. listed in section A.1.1 of the Second Edition and not listed in any
  99. of the other A.1 sections.
  100.  
  101. File operators:
  102.        filter (all but DCTEncode/Decode)
  103.  
  104. Resource operators:
  105.     defineresource, findresource, resourceforall, resourcestatus,
  106.     undefineresource
  107.  
  108. Character and font operators:
  109.     cshow, xshow, yshow, xyshow
  110.     findencoding, rootfont, setcachedevice2
  111.       (WMode is supported, but composite fonts are not)
  112.  
  113. Graphics state operators:
  114.     currentcolor, currentcolorspace, setcolor, setcolorspace
  115.       (except for Indexed with procedure, true Separation, and Pattern)
  116.     currentcolorrendering, setcolorrendering
  117.  
  118. Miscellaneous operators:
  119.     languagelevel
  120.  
  121. In addition, Ghostscript supports the following Level 2 facilities:
  122.  
  123.     - Use of a dictionary with the image and imagemask operators;
  124.  
  125.     - Use of a string or a file as data source with the image,
  126.     imagemask, and colorimage operators.
  127.  
  128. When the Level 2 features are present, Ghostscript also supports the
  129. following operator:
  130.  
  131.     <1 or 2> .setlanguagelevel -
  132.         Set the current language level to Level 1 or Level 2.
  133.           When the language level is 1, no Level 2 facilities
  134.           are provided.
  135.  
  136. Unimplemented Level 2 facilities
  137. --------------------------------
  138.  
  139. Ghostscript currently does not implement the following Level 2
  140. operators and variables:
  141.     currentdevparams, setdevparams
  142.     GlobalFontDirectory
  143.     glyphshow
  144.     makepattern
  145.     realtime
  146.     setpagedevice
  147.     startjob
  148.  
  149. Ghostscript currently does not implement the following Level 2
  150. facilities not enumerated above:
  151.     garbage collection
  152.     global and local VM
  153.     page devices
  154.     job control
  155.     halftone dictionaries
  156.     user names
  157.  
  158. Ghostscript-specific additions
  159. ==============================
  160.  
  161. Miscellaneous
  162. -------------
  163.  
  164. ^Z is counted as whitespace.
  165.  
  166. run can take either a string or a file as its argument.  In the former
  167. case, it uses findlibfile to open the file (searching directories as
  168. needed).  In the latter case, it just runs the file, closing it at the
  169. end, and trapping errors just as for the string case.
  170.  
  171. Mathematical operators
  172. ----------------------
  173.  
  174.     <number> arccos <number>
  175.         Computes the arc cosine of a number between -1 and 1.
  176.  
  177.     <number> arcsin <number>
  178.         Computes the arc sine of a number between -1 and 1.
  179.  
  180. Dictionary operators
  181. --------------------
  182.  
  183.     <dict> <integer> setmaxlength -
  184.         Changes the capacity of a dictionary, preserving its
  185.           contents.  Causes a dictfull error if the requested
  186.           capacity is less than the current number of occupied
  187.           entries.
  188.  
  189. String operators
  190. ----------------
  191.  
  192.     <string|name|other> <patternString> stringmatch <boolean>
  193.         Determines whether the string or name matches the given
  194.           pattern.  In the pattern, `*' matches any substring of
  195.           the string, `?' matches any single character, and `\'
  196.           quotes the next character.  If the first argument is not
  197.           a string or name, stringmatch returns true if
  198.           patternString is a single *, and false otherwise.
  199.  
  200.     <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
  201.         Encrypts fromString according to the algorithm for Adobe
  202.           Type 1 fonts, writing the result into toString.
  203.           toString must be at least as long as fromString or a
  204.           rangecheck error occurs.  state is the initial state of
  205.           the encryption algorithm (a 16-bit non-negative
  206.           integer); newState is the new state of the algorithm.
  207.  
  208.     <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
  209.         Decrypts fromString according to the algorithm for Adobe
  210.           Type 1 fonts, writing the result into toString.  Other
  211.           specifications are as for type1encrypt.
  212.  
  213. Relational operators
  214. --------------------
  215.  
  216.     <number|string> <number|string> max <number|string>
  217.         Returns the larger of two numbers or strings.
  218.  
  219.     <number|string> <number|string> min <number|string>
  220.         Returns the smaller of two numbers or strings.
  221.  
  222. File operators
  223. --------------
  224.  
  225.     <string> findlibfile <foundstring> <file> true or <string> false
  226.         Opens the file of the given name for reading.  If the file
  227.           cannot be opened using the supplied name, searches
  228.           through directories as described in use.doc.  If the
  229.           search fails, findlibfile simply pushes false on the
  230.           stack and returns, rather than causing an error.
  231.  
  232.     <file> <integer> unread -
  233.          Pushes back the last-read character onto the front of the
  234.           file.  If the file is only open for writing, or if the
  235.           integer argument is not the same as the last character
  236.           read from the file, causes an ioerror error.  May also
  237.           cause an ioerror if the last operation on the file was not
  238.           a reading operation.
  239.  
  240.     <file> <device> writeppmfile -
  241.         Writes the contents of the device, which must be an image
  242.           device, onto the file, in Portable PixMap (ppm) format.
  243.           Does not close the file.
  244.  
  245. Path operators
  246. --------------
  247.  
  248.     <x> <y> <width> <height> rectappend -
  249.     <numarray> rectappend -
  250.     <numstring> rectappend -
  251.         Appends a rectangle or rectangles to the current path, in
  252.           the same manner as rectfill, rectclip, etc.  Only
  253.           defined if the dps option is selected.
  254.  
  255. Filters
  256. -------
  257.  
  258. Ghostscript supports all standard filters except DCTEncode and
  259. DCTDecode.  Ghostscript does not support the use of a procedure as a
  260. data source or sink, only a file or a string.  In addition,
  261. Ghostscript supports two non-standard filters:
  262.  
  263.     <file|string> <seed_integer> /eexecDecode filter <file>
  264.         Creates a filter for decrypting data that has been
  265.           encrypted using eexec encryption as described in the
  266.           Adobe Type 1 Font Format documentation.  The
  267.           seed_integer must be 55665 for proper operation.
  268.  
  269.     <file|string> <hex_boolean> /PFBDecode filter <file>
  270.         Creates a filter that decodes data in .PFB format, the
  271.           usual semi-binary representation for Type 1 font files
  272.           on IBM PC and compatible systems.  If hex_boolean is true,
  273.           binary packets are converted to hex; if false, binary
  274.           packets are not converted.
  275.  
  276. Miscellaneous operators
  277. -----------------------
  278.  
  279.     - currenttime <number>
  280.         Returns the current value of a continuously-running timer,
  281.           in minutes.  The initial value of this timer is undefined.
  282.  
  283.     <string> getenv   <string> true  or  false
  284.         Looks up a name in the shell environment.  If the name is
  285.           found, returns the corresponding value and true; if the
  286.           name is not found, returns false.
  287.  
  288.     <name> <array> makeoperator <operator>
  289.         Constructs and returns a new operator that is actually the
  290.           given procedure in disguise.  The name is only used for
  291.           printing.  The operator has the executable attribute.
  292.  
  293.     <string> <boolean> setdebug -
  294.         If the Ghostscript interpreter was built with the DEBUG
  295.           flag set, sets or resets any subset of the debugging
  296.           flags normally controlled by -Z in the command line.
  297.           Has no effect otherwise.
  298.  
  299.     - oserrno <errno>
  300.         Returns the error code for the most recent OS error.
  301.  
  302.     - oserror <string>
  303.         Returns the error string for the most recent OS error.
  304.  
  305. Device operators
  306. ----------------
  307.  
  308.     <device> copydevice <device>
  309.         Copies a device.
  310.  
  311.     <index> getdevice <device>
  312.         Returns a device from the set of devices known to the
  313.           system.  The first device, which is default, is numbered
  314.           0.  If the index is out of range, causes a rangecheck
  315.           error.
  316.  
  317.     <matrix> <width> <height> <palette> makeimagedevice <device>
  318.         Makes a new device that accumulates an image in memory.
  319.           matrix is the initial transformation matrix: it must be
  320.           orthogonal (i.e., [a 0 0 b x y] or [0 a b 0 x y]).
  321.           palette is a string of 2^N or 3*2^N elements, specifying
  322.           how the 2^N possible pixel values will be interpreted.
  323.           Each element is interpreted as a gray value, or as RGB
  324.           values, multiplied by 255.  For example, if you want
  325.           a monochrome image for which 0=white and 1=black, the
  326.           palette should be <ff 00>; if you want a 3-bit deep
  327.           image with just the primary colors and their complements
  328.           (ignoring the fact that 3-bit images are not supported),
  329.           the palette might be <000000 0000ff 00ff00 00ffff
  330.           ff0000 ff00ff ffff00 ffffff>.  At present, the palette
  331.           must contain exactly 2, 4, 16, or 256 entries,
  332.           and must contain an entry for black and an entry
  333.           for white; if it contains any entries that aren't black,
  334.           white, or gray, it must contain at least the six primary
  335.           colors (red, green, blue, and their complements cyan,
  336.           magenta, and yellow); aside from this, its contents are
  337.           arbitrary.
  338.         Alternatively, palette can be null.  This is interpreted
  339.           as 24-bit-per-pixel color, where the four bytes of each
  340.           pixel are respectively R, G, and B.
  341.         Note that one can also make an image device (with the same
  342.           palette as an existing image device) by copying a device
  343.           using the copydevice operator.
  344.  
  345.     <device> <index> <string> copyscanlines <substring>
  346.         Copies one or more scan lines from an image device into a
  347.           string, starting at a given scan line in the image.
  348.           The data is in the same format as for the image
  349.           operator.  Error if the device is not an image device or
  350.           if the string is too small to hold at least one complete
  351.           scan line.  Always copies an integral number of scan
  352.           lines.
  353.  
  354.     <device> setdevice -
  355.         Sets the current device to the specified device.  Also
  356.           resets the transformation and clipping path to the
  357.           initial values for the device.
  358.  
  359.     - currentdevice <device>
  360.         Gets the current device from the graphics state.
  361.  
  362.     <device> devicename <string>
  363.         Gets the name of a device.
  364.  
  365.     <device> <matrix> deviceinitialmatrix <matrix>
  366.         Gets the initial matrix of a device, i.e., the one that
  367.           defaultmatrix would return if the device were the
  368.           current device.
  369.  
  370.     <device> getdeviceprops <mark> <name1> <value1> ... <namen> <valuen>
  371.         Gets all the properties of a device.  Currently defined
  372.           names and values for all devices are:
  373.             HWResolution [<float> <float>]
  374.                 X and Y resolution in pixels/inch.
  375.             HWSize [<integer> <integer>]
  376.                 X and Y size in pixels.
  377.             InitialMatrix [<6 floats>]
  378.                 Initial transformation matrix.
  379.             Name <string>
  380.                 Read-only.  The device name.
  381.         For printers, the following are also defined:
  382.             BufferSpace <integer>
  383.                 Buffer space for band lists, if the bitmap
  384.                   is too big to fit in RAM.
  385.             MaxBitmap <integer>
  386.                 Maximum space for a full bitmap in RAM.
  387.             OutputFile <string>
  388.                 () means send to printer directly,
  389.                   otherwise specifies the file name for
  390.                   output; a %d is replaced by the page #;
  391.                   on Unix systems, (|command) writes to a pipe
  392.             PageCount <integer>
  393.                 Read-only.  Counts the number of pages
  394.                   printed on the device.
  395.  
  396.     <mark> <name1> <value1> ... <namen> <valuen> <device>
  397.         putdeviceprops <device>
  398.         Sets properties of a device.  May cause undefined,
  399.           typecheck, rangecheck, or limitcheck errors.
  400.  
  401.     - flushpage -
  402.         On displays, flushes any buffered output, so that it
  403.           is guaranteed to show up on the screen; on printers,
  404.           has no effect.
  405.  
  406. Character operators
  407. -------------------
  408.  
  409.     <string> .type1addpath -
  410.     <string> <lsbx> <lsby> .type1addpath -
  411.         Adds the description of a character to the current
  412.           path.  The string argument is a scalable
  413.           description encoded in Adobe Type 1 format.  This
  414.           operator, like setcharwidth and setcachedevice, is
  415.           only valid in the context of a show operator.  It
  416.           uses information from the current font, in addition
  417.           to the argument(s).
  418.         The optional lsbx and lsby arguments are left side
  419.           bearing values that override the ones in the
  420.           character outline.
  421.  
  422.     <font> <char> Type1BuildChar -
  423.         This is not a new operator: rather, it is a name known
  424.           specially to the interpreter.  Whenever the interpreter
  425.           needs to render a character (during a ...show,
  426.           stringwidth, or charpath), it looks up the name
  427.           BuildChar in the font dictionary to find a procedure to
  428.           run.  If it does not find this name, and if the FontType
  429.           is 1, the interpreter instead uses the value (looked up
  430.           on the dictionary stack in the usual way) of the name
  431.           Type1BuildChar.
  432.         The standard definition of Type1BuildChar is in gs_fonts.ps.
  433.           Users should not need to redefine Type1BuildChar, except
  434.           perhaps for tracing or debugging.
  435.  
  436. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  437.  
  438. PostScript is a trademark of Adobe Systems, Incorporated.
  439.